home *** CD-ROM | disk | FTP | other *** search
/ Cracking 2 / Cracking II..iso / Texty / crackme / LaZaRuS XX.txt < prev    next >
Encoding:
Text File  |  1999-07-04  |  11.5 KB  |  242 lines

  1.  
  2.  
  3.                      L                ZZZZZZ         RRRRR           SSSSS
  4.                      L                    Z          R    R         S
  5.                      L          aaa      Z      aaa  R    R  u   u  S
  6.                      L            a     Z         a  RRRRR   u   u  SSSSS
  7.                XX    L         aaaa    Z       aaaa  R    R  u   u       S
  8.               XXXX   L        a   a   Z       a   a  R    R  u   u       S
  9.              XXXXXX  LLLLLLL  aaaaa  ZZZZZZZ  aaaaa  R    R  uuuuu  SSSSSS
  10.              XXXXXX       
  11.         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  12.        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  13.         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  14.              XXXXXX
  15.              XXXXXX
  16.               XXXX        proudly presents his 19.Cracking Tutorial (04.07.1999)
  17.                XX                       Cruehead's CrackMe 1.0
  18.  
  19. I.    Introduction
  20. I.1   Tools you need for my tutorial
  21. II.   The "Kick the nag" approach
  22. VI.   BTW
  23. VII.  All Tutorials by LaZaRuS
  24.  
  25. I.   Welcome to my 20st cracking tutorial.
  26.  
  27. I.1  W32Dasm 8.9
  28.      Cruehead's CrackMe 1.0
  29.  
  30. II.  Thanx Cruehead. I thought first that this one will be pretty easy and could be done in one
  31.      minute. But I fastly saw that I would have to follow the serial calculation. So I needed
  32.      two minutes ;)
  33.  
  34.      Whatever, let's start. (Although there's no need to disassemble it (as you say), I only have
  35.      W32Dasm on this computer and my SICE is 900km away from here :( So I have to break this 
  36.      rule). Load CrackMe.exe in W32Dasm. You will see some string references. The most important
  37.      is "Great work, mate!". Search for it and you see this:
  38.  
  39.      * Referenced by a CALL at Address:
  40.      |:0040124C   
  41.      |
  42.      :0040134D 6A30                    push 00000030
  43.  
  44.      * Possible StringData Ref from Data Obj ->"Good work!"
  45.                                        |
  46.      :0040134F 6829214000              push 00402129
  47.  
  48.      * Possible StringData Ref from Data Obj ->"Great work, mate!"
  49.                                        |
  50.      :00401354 6834214000              push 00402134
  51.      :00401359 FF7508                  push [ebp+08]
  52.  
  53.      * Reference To: USER32.MessageBoxA, Ord:0000h
  54.                                   |
  55.      :0040135C E8D9000000              Call 0040143A
  56.      :00401361 C3                      ret
  57.  
  58.      We can easily see that this messagebox is called from :0040124C. So let's have a look at
  59.      this passage.
  60.  
  61.      :00401240 58                      pop eax       ;; load one value
  62.      :00401241 3BC3                    cmp eax, ebx  ;; compare two values
  63.      :00401243 7407                    je 0040124C   ;; if same, then jump to "Well done" message
  64.      :00401245 E818010000              call 00401362 ;; call "wrong" message
  65.      :0040124A EB9A                    jmp 004011E6  ;; go on
  66.  
  67.      * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  68.      |:00401243(C)
  69.      |
  70.      :0040124C E8FC000000              call 0040134D  ;; call "well done" messagebox
  71.      :00401251 EB93                    jmp 004011E6   ;; go on
  72.  
  73.      So pretty obviously: Either eax or ebx should contain the correct serial and the other 
  74.      register should contain the value you have entered, then. When you try it you will see that
  75.      is not this way. So we have to follow how these two values are calculated.
  76.  
  77.      :00401228 688E214000              push 0040218E ;; 40218E contains the name you entered
  78.      :0040122D E84C010000              call 0040137E ;; calculates first value
  79.      :00401232 50                      push eax      ;; saves first value
  80.      :00401233 687E214000              push 0040217E ;; saves serial you entered
  81.      :00401238 E89B010000              call 004013D8 ;; calculates second value
  82.      :0040123D 83C404                  add esp, 00000004
  83.      :00401240 58                      pop eax       ;; loads first value
  84.      :00401241 3BC3                    cmp eax, ebx  ;; compare first with second value
  85.      :00401243 7407                    je 0040124C   ;; if same, then jump to "Well done"
  86.  
  87.      The first call is this:
  88.  
  89.      * Referenced by a CALL at Address:
  90.      |:0040122D   
  91.      |
  92.      :0040137E 8B742404                mov esi, dword ptr [esp+04]  ;; esi=name
  93.      :00401382 56                      push esi                     ;; save name
  94.  
  95.      * Referenced by a (U)nconditional or (C)onditional Jump at Addresses:
  96.      |:00401392(U), :0040139A(U)
  97.      |
  98.      :00401383 8A06                    mov al, byte ptr [esi]       ;; mov first letter in al
  99.      :00401385 84C0                    test al, al                  ;; al=0 ?
  100.      :00401387 7413                    je 0040139C                  ;; if so, then exit loop
  101.      :00401389 3C41                    cmp al, 41                   ;; al<41? (41h=65=A)
  102.      :0040138B 721F                    jb 004013AC                  ;; if so, then "Wrong"
  103.      :0040138D 3C5A                    cmp al, 5A                   ;; if al >= 5A (5A=90=Z)
  104.      :0040138F 7303                    jnb 00401394                 ;; if so, then jump
  105.      :00401391 46                      inc esi                      ;; point to next letter
  106.      :00401392 EBEF                    jmp 00401383                 ;; loop
  107.  
  108.      * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  109.      |:0040138F(C)
  110.      |
  111.      :00401394 E839000000              call 004013D2                ;; ASCII(letter) - 20h
  112.      :00401399 46                      inc esi                      ;; point to next letter
  113.      :0040139A EBE7                    jmp 00401383                 ;; loop
  114.  
  115.      * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  116.      |:00401387(C)
  117.      |
  118.      :0040139C 5E                      pop esi                      ;; load name again
  119.      :0040139D E820000000              call 004013C2                ;; see below
  120.      :004013A2 81F778560000            xor edi, 00005678            ;; XOR value with 5678h
  121.      :004013A8 8BC7                    mov eax, edi                 ;; save value in eax
  122.      :004013AA EB15                    jmp 004013C1                 ;; go on
  123.  
  124.      * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  125.      |:0040138B(C)
  126.      |
  127.      :004013AC 5E                      pop esi                      ;; show a "Wrong" MessageBox
  128.      :004013AD 6A30                    push 00000030 
  129.   
  130.      * Possible StringData Ref from Data Obj ->"No luck!"
  131.                                        |
  132.      :004013AF 6860214000              push 00402160
  133.  
  134.      * Possible StringData Ref from Data Obj ->"No luck there, mate!"
  135.                                        |
  136.      :004013B4 6869214000              push 00402169
  137.      :004013B9 FF7508                  push [ebp+08]
  138.  
  139.      * Reference To: USER32.MessageBoxA, Ord:0000h
  140.                                        |
  141.      :004013BC E879000000              Call 0040143A
  142.  
  143.      * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  144.      |:004013AA(U)
  145.      |
  146.      :004013C1 C3                      ret
  147.  
  148.      Let's explain: This passage does nothing but converting the name you entered to capital
  149.      letters. LaZaRuS will be LAZARUS after this passage. Eh, not really. I assume Cruehead
  150.      made a mistake coding this passage. LaZaRuS will be LA:ARUS after this passage. In my 
  151.      opinion the following line:
  152.  
  153.      :0040138F 7303                    jnb 00401394                 ;; if so, then jump
  154.  
  155.      must be
  156.  
  157.      :0040138F 7?03                    jb 00401394                  ;; if so, then jump
  158.  
  159.      Then the name would be converted correctly. I'll ask Cruehead when I meet him next time.
  160.  
  161.      So let's have a look at the call :0040139D
  162.  
  163.      * Referenced by a CALL at Address:
  164.      |:0040139D   
  165.      |
  166.      :004013C2 33FF                    xor edi, edi  ;; erase edi
  167.      :004013C4 33DB                    xor ebx, ebx  ;; erase ebx
  168.  
  169.      * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  170.      |:004013CF(U)
  171.      |
  172.      :004013C6 8A1E                    mov bl, byte ptr [esi]  ;; bl = 1st char of conv. name
  173.      :004013C8 84DB                    test bl, bl             ;; bl=0?
  174.      :004013CA 7405                    je 004013D1             ;; if so, then exit loop
  175.      :004013CC 03FB                    add edi, ebx            ;; edi=edi + 1st letter
  176.      :004013CE 46                      inc esi                 ;; point to next letter
  177.      :004013CF EBF5                    jmp 004013C6            ;; loop
  178.  
  179.      * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  180.      |:004013CA(C)
  181.      |
  182.      :004013D1 C3                      ret                     ;; return from call
  183.  
  184.      This passage will add all ASCII values of each letter of the converted string. For LA:ARUS
  185.      this will be: 4C+41+3A+41+52+55+53 (hex values). This is 202h. When you return from the call
  186.      this value will be XORed with 5678h. The result is 547Ah. This is one of the values that
  187.      are compared at the end. So, let's look for the other.
  188.      The important call is at :00401238. If you enter, you will see this:
  189.  
  190.      * Referenced by a CALL at Address:
  191.      |:00401238   
  192.      |
  193.      :004013D8 33C0                    xor eax, eax  ;; erase eax
  194.      :004013DA 33FF                    xor edi, edi  ;; erase edi
  195.      :004013DC 33DB                    xor ebx, ebx  ;; erase ebx
  196.      :004013DE 8B742404                mov esi, dword ptr [esp+04]  ;; esi=serial
  197.  
  198.      * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  199.      |:004013F3(U)
  200.      |
  201.      :004013E2 B00A                    mov al, 0A             ;;-------------- This one just
  202.      :004013E4 8A1E                    mov bl, byte ptr [esi] ;;             | copies the serial
  203.      :004013E6 84DB                    test bl, bl            ;;             | you entered to edi
  204.      :004013E8 740B                    je 004013F5            ;;             | I entered 666999
  205.      :004013EA 80EB30                  sub bl, 30             ;;             | so edi will 
  206.      :004013ED 0FAFF8                  imul edi, eax          ;;             | contain A2D77 (the
  207.      :004013F0 03FB                    add edi, ebx           ;;             | hex-value of my
  208.      :004013F2 46                      inc esi                ;;             | serial) at the end
  209.      :004013F3 EBED                    jmp 004013E2           ;;--------------
  210.  
  211.      * Referenced by a (U)nconditional or (C)onditional Jump at Address:
  212.      |:004013E8(C)
  213.      |
  214.      :004013F5 81F734120000            xor edi, 00001234      ;; XORes the serial with 1234h
  215.      :004013FB 8BDF                    mov ebx, edi           ;; saves second value in ebx
  216.      :004013FD C3                      ret                    ;; return from call
  217.  
  218.      The value I get is A3F43h (A2D77h XOR 1234h). That's obviously not the same as 547Ah which
  219.      I got as first value. The first value is unchangable (as I want to reg it with LaZaRuS), so
  220.      let's have a look at the second one.
  221.  
  222.      We know:
  223.      [All letters of name added] XOR 5678h == Serial XOR 1234h
  224.                                      547Ah == Serial XOR 1234h
  225.      -> serial = 547Ah XOR 1234h
  226.         serial = 464E
  227.  
  228.      We have to convert this value back to decimal: 17998
  229.  
  230.      So at the end we have:
  231.      Name: LaZaRuS
  232.      Code: 17998
  233.  
  234.  
  235. I.  BTW
  236.      
  237.      Greets to: tKC, Ed!son, Moral Insanity, +Sandman, Fravia+ and everyone at #cracking4newbies,
  238.      +Sandman's forum and Fravia+'s forum.
  239.  
  240. VII. All tutorials by LaZaRuS
  241.       
  242.